<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      /* 默认初始边距样式为0； */
      margin: 0px;
      padding: 0px;
    }
    ul,li{
      list-style: none;
    }
    .a{
      margin: 0px auto;
      width: 1227px;
    }
    .a ul{
      height: 50px;
      background-color: chartreuse;
    }
    ul li{
      float: left;
      padding: 0px 50px;
      line-height: 50px;
    }
    .b{
      float: left;
      padding: 0px 50px;
      line-height: 50px;
      background-color: rgb(255, 127, 127);
    }
    .d{
      display: none;
    }
  </style>
</head>
<body>
  <div class="a">
  <ul>
    <li class="b" index="0">公司介绍</li>
    <li index="1">产品介绍</li>
    <li index="2">联系我们</li>
    <li index="3">其他服务</li>
  </ul>

  <div class="c">
    <div class="d">公司介绍</div>
    <div class="d">产品介绍</div>
    <div class="d">联系我们</div>
    <div class="d">其他服务</div>
  </div>
</div>
<script>
  // var ul = document.querySelector('ul');
  var li = document.querySelectorAll('li');
  var d = document.querySelectorAll('.d');
  for(var i=0;i<li.length;i++)
  {
    li[i].onmousemove = function(){
      for(var i=0;i<li.length;i++)
      {
        li[i].className='';
      }
      this.className='b';
      var index = this.getAttribute('index');
      for(var i=0;i<d.length;i++){
        d[i].style.display='none';
      }
      d[index].style.display = 'block';
    }
  }
</script>
</body>
</html>